import service from '@/utils/request'

export const useDataSourceTestApi = (id) => {
  return service.get('/maku-generator/gen/datasource/test/' + id)
}

export const useDataSourceApi = (id) => {
  return service.get('/maku-generator/gen/datasource/' + id)
}

export const useDataSourceListApi = () => {
  return service.get('/maku-generator/gen/datasource/list')
}

export const useDataSourceSubmitApi = (dataForm) => {
  if (dataForm.id) {
    return service.put('/maku-generator/gen/datasource', dataForm)
  } else {
    return service.post('/maku-generator/gen/datasource', dataForm)
  }
}

export const useDataSourceTableListApi = (id) => {
  return service.get('/gen/datasource/table/list/' + id)
}
